﻿package mortal.game.view.battlefield
{
    import mortal.game.manager.*;
    import mortal.game.mvc.*;
    import mortal.game.scene3D.map3D.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.display.*;
    import mortal.mvc.core.*;

    public class BattlefieldContinueCutNumView extends View
    {
        private var _bmptxt:BitmapNumberText;
        private var _num:int;
        private static var _instance:BattlefieldContinueCutNumView;

        public function BattlefieldContinueCutNumView()
        {
            this.layer = LayerManager.entityTalkLayerParent;
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this.mouseEnabled = false;
            this.mouseChildren = false;
            this._bmptxt = UIFactory.bitmapNumberText(0, 0, "BattlefieldContinueCutNum.png", 68, 80, -16, this, 10, BitmapNumberText.Left);
            Dispatcher.addEventListener(EventName.StageResize, this.onStageResize);
            return;
        }// end function

        public function updateNum(param1:int) : void
        {
            this._num = param1;
            this._bmptxt.text = param1.toString();
            this.stageResize();
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._num = 0;
            this._bmptxt.dispose();
            this._bmptxt = null;
            Dispatcher.removeEventListener(EventName.StageResize, this.onStageResize);
            super.disposeImpl();
            return;
        }// end function

        private function onStageResize(param1 = null) : void
        {
            this.stageResize();
            return;
        }// end function

        override public function stageResize() : void
        {
            var _loc_1:* = this._num.toString().length;
            var _loc_2:* = SceneRange.display.width / 2 - 350 - (_loc_1 - 1) * 52;
            var _loc_3:* = SceneRange.display.height / 2 - 156;
            this.x = _loc_2;
            this.y = _loc_3;
            return;
        }// end function

        public static function get instance() : BattlefieldContinueCutNumView
        {
            if (!_instance)
            {
                _instance = new BattlefieldContinueCutNumView;
            }
            return _instance;
        }// end function

    }
}
